def email_template_generator(name, product, price, discount=0):
    """邮件模板生成器"""
    template = """
尊敬的 {name}，

感谢您购买 {product}！

订单详情:
- 产品: {product}
- 原价: ${original_price:.2f}
- 折扣: {discount_percent}%
- 实付: ${final_price:.2f}

如有任何问题，请随时联系我们。

祝好，
客服团队
"""

    original_price = price
    discount_amount = price * discount / 100
    final_price = price - discount_amount

    email_content = template.format(
        name=name,
        product=product,
        original_price=original_price,
        discount_percent=discount,
        final_price=final_price
    )

    return email_content.strip()


# 生成邮件
email = email_template_generator("张三", "Python编程书", 59.99, 10)
print("生成的邮件:")
print(email)